package com.infoland.afanmall.model.order.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.AppCompatTextView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.infoland.afanmall.R;
import com.infoland.afanmall.base.util.ToolsKit;
import com.infoland.afanmall.model.order.dialog.PayDialogBy;
import com.infoland.afanmall.model.order.entity.OrderByResponse;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;


public class PaySuccessActivity extends AppCompatActivity {

    @BindView(R.id.success_pay_type)
    AppCompatTextView successPayType;
    @BindView(R.id.success_pay_price)
    AppCompatTextView successPayPrice;
    @BindView(R.id.success_pay_look)
    AppCompatTextView successPayLook;
    @BindView(R.id.success_pay_ok)
    TextView successPayOk;
    @BindView(R.id.cart_ll1)
    LinearLayout cartLl1;

    public static OrderDownActivity downCartActivity;
    public static PayDialogBy payDialogBy;
    public static String type;
    public static String error_type;
    public static OrderByResponse.ObjectBean object;


    public static void setPara(OrderByResponse.ObjectBean object, String type,
                               OrderDownActivity downCartActivity, String error_type,
                               PayDialogBy payDialogBy) {
        PaySuccessActivity.downCartActivity = downCartActivity;
        PaySuccessActivity.type = type;
        PaySuccessActivity.error_type = error_type;
        PaySuccessActivity.payDialogBy = payDialogBy;
        PaySuccessActivity.object = object;

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.pay_success_activity);
        ButterKnife.bind(this);
        initData();
    }

    private void initData() {
    }

    @OnClick({R.id.success_pay_look, R.id.success_pay_ok})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.success_pay_look:
                ToolsKit.setSleep(successPayLook, 2000);

                if (downCartActivity != null) {
                    downCartActivity.finish();
                }
                finish();
                ToolsKit.go(OrderInfoActivity.class);
                break;
            case R.id.success_pay_ok:
                ToolsKit.setSleep(successPayOk, 2000);

                if (downCartActivity != null) {
                    downCartActivity.finish();
                }
                finish();
                break;
        }
    }
    @Override
    protected void onDestroy() {
        ToolsKit.deleteOKHttp(this);
        super.onDestroy();
    }
}